#*******************************************************************
#* @ All Rights Reserved Copyright (C) 2014 broada,Co.,Ltd.        *
#*                                                                 *
#*  NOTE      = apm提供给lua调用的通用模块
#*  DATE      = 
#*******************************************************************

#共通参数
include         ../apmmodule/Makefile_comm.mk

INCLUDES        =  -I. -I$(LIB_I_APM_COMM) -I$(LIB_I_APM_MODULE) -I$(LIB_I_APM_PLUGINLUA)
LIBS            = -lzlog -lpthread
CFLAGS          = -fPIC

CFLAGS          += $(CFLAGS_EXT)
CFLAGS          += $(CFLAGS_UTEST)

LIBS            += $(LIBS_EXT)

MK_LIB_PATH     =$(COMM_DIST_DIR_LUALIB)
TARGET_LIB_LN   = apm4lua.so
TARGET_LIB_VER  = apm4lua_2.0.so

SRC_LIB  = $(wildcard *.c)
OBJS_LIB = $(patsubst %.c, %.o, $(SRC_LIB))

all: $(TARGET_LIB_VER)

.c.o:$(OBJS_LIB)
	$(CX) -c $(CFLAGS) $(INCLUDES)  $<

$(TARGET_LIB_VER): $(OBJS_LIB)
	$(CX) -shared -fPIC  $^ $(LIB_A_APM_MODULE) $(LIB_A_APM_COMM) -o $@ $(INCLUDES) $(LIBS)
	rm -f *.o

install:
	mkdir -p $(MK_LIB_PATH)
	cp $(TARGET_LIB_VER) $(MK_LIB_PATH)/.; cd $(MK_LIB_PATH); rm -f $(TARGET_LIB_LN);ln -s $(TARGET_LIB_VER) $(TARGET_LIB_LN)

uninstall:
	rm -rf $(MK_LIB_PATH)/$(TARGET_LIB_VER);rm -f $(MK_LIB_PATH)/$(TARGET_LIB_LN)

clean:
	rm -f *.o $(TARGET_LIB_VER)

#EOF

